<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/4/13
  Time: 17:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>

</head>
<script>


</script>
<body>
<div class="pager">
    <ul>
        <%--判断当前页数是否是大于1的--%>
        <c:if test="${currentPage > 1}">
            <li>
                <a href="${pageContext.request.contextPath}/file?method=findFlieByPath&currentPage=1">首页</a>
            </li>
            <li>
                <a href="${pageContext.request.contextPath}/file?method=findFlieByPath&currentPage=${currentPage-1}">上一页</a>
            </li>
        </c:if>

        <%--遍历所有的页数--%>
        <c:forEach begin="1" end="${totalPage}" var="num">
            <c:choose>
                <c:when test="${num == currentPage}">  <%-- 页数等于当前页数是不需要 链接--%>
                    <li class="active"><a style="color:red;"><b>${num}</b></a></li>
                </c:when>
                <c:otherwise>
                    <li>
                        <a href="${pageContext.request.contextPath}/file?method=findFlieByPath&currentPage=${num}">${num}</a>
                    </li>
                </c:otherwise>
            </c:choose>
        </c:forEach>

        <%--如果当前的页数小于总页数展示有下一页--%>
        <c:if test="${currentPage < totalPage}">
            <li>
                <a href="${pageContext.request.contextPath}/file?method=findFlieByPath&currentPage=${currentPage+1}">下一页</a>
            </li>
            <li>
                <a href="${pageContext.request.contextPath}/file?method=findFlieByPath&currentPage=${totalPage}">尾页</a>
            </li>
        </c:if>

    </ul>
</div>


</body>
</html>
